package cn.iocoder.yudao.module.alipay.dal.mysql.surname;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.alipay.dal.dataobject.surname.SurnameDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.alipay.controller.admin.surname.vo.*;

/**
 * 姓氏 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface SurnameMapper extends BaseMapperX<SurnameDO> {

    default PageResult<SurnameDO> selectPage(SurnamePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SurnameDO>()
                .likeIfPresent(SurnameDO::getName, reqVO.getName())
                .betweenIfPresent(SurnameDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SurnameDO::getId));
    }

    default List<SurnameDO> selectList(SurnameExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<SurnameDO>()
                .likeIfPresent(SurnameDO::getName, reqVO.getName())
                .betweenIfPresent(SurnameDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SurnameDO::getId));
    }

    default SurnameDO getByName(String name){
        return selectOne(new LambdaQueryWrapperX<SurnameDO>()
                .eq(SurnameDO::getName, name));
    }

}
